package com.bkgy.modular.tbcountinuous.controller;

import com.alibaba.fastjson.JSON;
import com.bkgy.modular.tbcountinuous.entity.TbCountinuousReq;
import com.bkgy.modular.tbcountinuous.entity.TbCountinuousRollingSteelGrade;
import com.bkgy.modular.tbcountinuous.service.TbCountinuousService;
import com.bkgy.modular.tbdatadictionary.entity.JTbDataDictionary;
import com.bkgy.sys.common.entity.JCommon;
import com.bkgy.sys.common.entity.ResultData;
import com.bkgy.util.CodiUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Author:Lipeng Zhao
 * Description:
 *
 * @Date:Created In 9:50 2025/11/26
 */
@RestController
@RequestMapping("/tbCountinuous")
public class TbCountinuousController {

    @Autowired
    private TbCountinuousService tbCountinuousService;

    /**
     * 添加记录
     * @param data userId 用户id
     * @param data sname 用户姓名
     * */
    @CrossOrigin
    @RequestMapping(value={"/insert"}, method= RequestMethod.POST)
    @ResponseBody
    public ResultData insertDataTbCountinuous(@RequestBody String data){
        return tbCountinuousService.insertDataTbCountinuous(data);
    };

    /**
     * 根据主键删除对象
     * @param data json字符串
     * */
    @CrossOrigin
    @RequestMapping(value={"/deleteOne"}, method= RequestMethod.POST)
    @ResponseBody
    public ResultData deleteDataTbCountinuousOne(@RequestBody TbCountinuousReq data){
        try{
            return tbCountinuousService.deleteDataTbCountinuousOne(data.getSteelgrade());
        }catch(Exception e){
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("访问接口错误，错误信息为" + e.getMessage(), null);
        }
    };

    /**
     * 分页查看记录
     * @param data json字符串
     */
    @CrossOrigin
    @RequestMapping(value = {"/findByPage"}, method = RequestMethod.POST)
    @ResponseBody
    public ResultData findDataTbCountinuousByPage(@RequestBody String data) {
        return tbCountinuousService.findDataTbCountinuousByPage(data);
    }
}
